
oldName=input("请输入你要备份的文件名：")
index=oldName.rfind(".")
print(index)#获取后缀中下标位置
print(oldName[:index])#源文件名，无后缀
print(oldName)#源文件全名
# newName=oldName[:index]+"[备份]"+oldName[index:]
if index > 0:
    postfix=oldName[index:]
print(postfix) 
newNane=oldName[:index]+"[备份]"+postfix
oldF=open(oldName,"rb")
newF=open(newNane,"wb")
while True:
  con=oldF.read(1024)
  if len(con)==0 :
    break
  newF.write(con)
# print(newName)
oldF.close()
newF.close()





